package com.marvels.loanapply.consum.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;
import com.marvels.common.utils.MarvelsLogUtil;
import com.marvels.loanapply.channel.dto.SysUserDTO;
import com.marvels.loanapply.channel.dto.SysUserParamDTO;
import com.marvels.loanapply.consum.LoanapplyConsumerSystemApi;
import com.marvels.system.permission.service.SysUserService;

import cn.hutool.core.bean.BeanUtil;

@Component
public class LoanapplyConsumSystemImpl implements LoanapplyConsumerSystemApi{

	@Autowired
	private SysUserService sysUserService;
	
	@Override
	public List<SysUserDTO> querySysUsers(SysUserParamDTO sysUserParamDTO) {
		try {
			com.marvels.system.permission.dto.SysUserParamDTO param= new com.marvels.system.permission.dto.SysUserParamDTO();
			BeanUtil.copyProperties(sysUserParamDTO, param);
			List<com.marvels.system.permission.dto.SysUserDTO> apiResult = sysUserService.querySysUsers(param);
			List<SysUserDTO> result = JSONObject.parseArray(JSONObject.toJSONString(apiResult), SysUserDTO.class);
			MarvelsLogUtil.getInstance().info("LoanapplyConsumerSystemApi.querySysUsers direct call success!");
			return result;
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("LoanapplyConsumerSystemApi.querySysUsers error", e);
			return null;
		}
	}


}
